<template>
	<view>
		<view class="module ">
			<uNavbar title="品牌权益" :bgColor="backgroundColor" :titleStyle="titleStyle" leftIconColor="#ffffff"></uNavbar>
			<image v-if="brandList.length>0" class="bgimg" src="../../static/image/bg7.png" mode="aspectFill"></image>
			<view class="interests flex_dq" v-for="(item,index) in brandList" :key="index" @click="goDetails(item)">
				<view class="interests_l flex_c">
					<image :src="item.goods_image" mode="aspectFill"></image>
				</view>
				<view class="interests_c flex_Z">
					<text>{{item.goods_name}}</text>
					<view class="" v-for="(item2,index) in item.be_introduction" :key="item2.id">
						<text class="share">{{item2}}</text>
					</view>
				</view>
				<view class="interests_r flex_c">
					<text>查看权益</text>
				</view>
			</view> 
			<noDatas :xxxList="brandList" :status="status"></noDatas>
			<view class="empty"></view>
		</view>
		<!-- 暂无数据 / 加载更多 -->
		
	</view>
</template>

<script>
	import {incubationCards} from "../../api/store.js";
	export default {
		data() {
			return {
				page: 1,
				size: 10,
				status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
				titles: "",
				backgroundColor: "transparent",
				titleStyle:{
					color:'#ffffff'
				},
				brandList:[]
			}
		},
		onLoad(e) {
			this.ids = e.id
			this.initList()
		},
		methods: {
			// 初始化
			initList() {
				let data = {
					brand_id:this.ids,
					page:this.page,
				};
				incubationCards(data).then(res => {
					console.log(res);
					if (res.code == 1) {
						let list = res.data.data;
						this.brandList = this.page == 1 ? list : this.brandList.concat(list);
						console.log(this.brandList);
						if (list.length < this.size) this.status = 'nomore';
						else this.status = 'loading';
					}
				})
			},
			// 去详情
			goDetails(item){
				uni.navigateTo({
					url:'/pagesMy/brandCenter/brandEquityDetail?id=' + item.id + '&name=' + item.goods_name
				})
			},
		},
		// 下拉刷新
		onPullDownRefresh() {
			console.log('下拉刷新');
			let that = this;
			setTimeout(function() {
				that.page = 1,
				that.brandList = [],
				that.initList()
			}, 800);
		},
		onReachBottom() {
			console.log('触底加载');
			if (this.status != 'nomore') {
				this.page = this.page + 1
				this.initList()
			}
		}
	}
</script>

<style scoped>
	.module {
		position: relative;
		width: 100%;
		height: 500rpx;
		/* background: url('../../static/image/bg7.png');
		background-size: 100% 100%; */
	}
	.bgimg{
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 500rpx;
		z-index: 1;
	}
	.interests{
		position: relative;
		width: 690rpx;
		height: 200rpx;
		background: #ffffff;
		box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0,0,0,0.05);
		border-radius: 16rpx;
		margin: 30rpx auto;
		z-index: 999;
	}
	.interests_l{
		
	}
	.interests_l>image{
		width: 152rpx;
		height: 152rpx;
		border-radius: 12rpx;
		margin: 0 24rpx;
	}
	.interests_c{
		width: 320rpx;
	}
	.interests_c>text:nth-child(1){
		font-size: 32rpx;
		color: #FC3F32;
	}
	.interests_r{
		width: 150rpx;
		height: 56rpx;
		background: linear-gradient( 270deg, #FC3F32 0%, #FC7232 99%);
		border-radius:40rpx;
		font-size: 26rpx;
		color: #ffffff;
	}
	.share{
		font-size: 28rpx;
		color: #916453;
		display: -webkit-box;
		overflow: hidden;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
	}
	

</style>